/*
 *  Copyright 2019-2025 Zheng Jie
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package me.zhengjie.gas.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @website https://eladmin.vip
 * @description /
 * @author Joe Tan
 * @date 2025-08-25
 **/
@Entity
@Data
@Table(name="oil")
public class Oil implements Serializable {
    @Id
    @Column(name = "id")
    @ApiModelProperty(value = "id")
    private Long id;

    @Column(name = "dept_id")
    @ApiModelProperty(value = "dept_id")
    private Long deptId;

    @Column(name = "oil_id")
    @ApiModelProperty(value = "oil_id")
    private Integer oilId;

    @Column(name = "oil_name")
    @ApiModelProperty(value = "oil_name")
    private String oilName;

    @Column(name = "oil_density",nullable = false)
    @NotNull
    @ApiModelProperty(value = "oil_density")
    private Double oilDensity;

    @Column(name = "price",nullable = false)
    @NotNull
    @ApiModelProperty(value = "price")
    private Double price;

    @Column(name = "color_str",nullable = false)
    @NotNull
    @ApiModelProperty(value = "color_str")
    private String colorStr;

    @Column(name = "created_ts",nullable = false)
    @NotNull
    @ApiModelProperty(value = "created_ts")
    private LocalDateTime createdTs;

    @Column(name = "last_updated_ts")
    @ApiModelProperty(value = "last_updated_ts")
    private LocalDateTime lastUpdatedTs;

    @Column(name = "remark")
    @ApiModelProperty(value = "remark")
    private String remark;



    public void copy(Oil source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
